#!/bin/bash
# 初始化负载均衡平衡器

if [ $UID -ne 0 ]; then
    echo "Superuser privileges are required to run this script."
    echo "e.g. \"sudo $0\""
    exit 1
fi

# 获取目录
balancerResource=$(cd ../resource/balancer1; pwd)

cd ${balancerResource}

tar -C /var -xzf balancer1.tar.gz
cd /var/balancer1/config.d

sed -i -e "s@#{domain}@"${domain}"@g"\
 http.conf

ln -fs /var/balancer1/jk.conf /etc/httpd/conf.modules.d/jk.conf
service httpd restart

echo "init balancer successfully"
